#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
vector<pair<int, int>> a;
using ll = long long;
int main() {
  string s;
  cin >> s;
  s += '&'; // 在字符串末尾添加空格，方便处理最后一个字符
  int cnt = 1;

  int k = s.size();
  for (int i = 1; i < k ; i++) {
    if (s[i] == s[i - 1]) {
      cnt++;
    } else {
      a.push_back({s[i - 1] - '0', cnt});
      cnt = 1;
    }
  }

  ll ans = 0;
  for (int i = 1; i < a.size(); i++) {
    if (a[i].first + 1 == a[i + 1].first) {
      ans += min(a[i].second, a[i + 1].second);
    }
  }
  cout << ans;
  return 0;
}